package com.ruyuan.seckilling.common.message;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * @author zhonghuashishan
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PagePublishMessage {

    // 流水id
    private Long pageLogId;

    // 告诉页面发布服务从哪里下载渲染好的静态页面
    private String staticPageId;

    // 告诉页面发布系统把渲染好的静态页面写到磁盘的那个路径
    private String staticPagePath;

    public String toJsonString() {
        return JSON.toJSONString(this);
    }

    public boolean selfCheck() {
        return StringUtils.isNotBlank(staticPageId)
                && StringUtils.isNotBlank(staticPagePath);
    }
}